package com.abbcc.models;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import com.abbcc.service.BaseService;
import com.abbcc.util.BeansFactory;

@Entity
@Table(name = "p_menu")
public class TdMenu {
	private int menuId;
	private String name;
	private int userId;
	@Id 
	@Column(name="menu_id") 
	public int getMenuId() {
		return menuId;
	}
	public void setMenuId(int menuId) {
		this.menuId = menuId;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	@Column(name="user_id") 
	public int getUserId() {
		return userId;
	}
	public void setUserId(int userId) {
		this.userId = userId;
	}
	public String isCheck(int userId,String menuName){
		BaseService baseService = (BaseService)BeansFactory.get("baseService");
		TdMenu td = new TdMenu();
		td.setUserId(userId);
		td.setName(menuName);
		if(baseService.findByExample(td).size()>0)
			return "01";
		else
			return "";
	}
}
